home *** CD-ROM | disk | FTP | other *** search
/ Experimental BBS Explossion 3 / Experimental BBS Explossion III.iso / c / cp1.zip / BOX1.C < prev    next >
Text File  |  1993-05-26  |  3KB  |  83 lines

  1. ===========================================================================
  2.  BBS: The Abacus * HST/DS * Potterville MI
  3. Date: 05-22-93 (20:31)             Number: 98
  4. From: BRIAN FRASER                 Refer#: 152
  5.   To: JIM BURNS                     Recvd: NO  
  6. Subj: ASCII BOXES                    Conf: (36) C Language
  7. ---------------------------------------------------------------------------
  8. -=> Jim Burns wrote in a message to All: <=-
  9. Hello Jim!
  10.  
  11. JB> I'm having a problem with a simple function that given the
  12. JB> ranges for x and y builds a box with ascii characters, 179,
  13. JB> 196,191,192,218, it's straightforword, but the frustration
  14. JB> comes when I try to place the lower right corner, 217.
  15. JB> Despite changeing the order of placement, after the
  16. JB> character is written to the lowest right coordinate the
  17. JB> cursor automatically gets a carriage return/line feed and
  18. JB> the entire thing shifts up a line and off alignment.  I've
  19. JB> noticed that even borlands C++ environment doesn't write
  20. JB> it's boxes to the lowest right corner, should I be taking
  21. JB> the hint, I ran across a little idea to write directly to
  22. JB> the video board, but I'm not sure it really works and then
  23. JB> what about portability is the color video address always
  24. JB> xB8000 ? .
  25.  
  26. I gather you are using BC++... If you are using the CONIO text routines. There i
  27. s a global _wscroll . It defaults to 1, but if you set it to 0, then the routine
  28. s wont scroll the window.
  29.  
  30. Here's a routine I have written to draw a box on the screen...
  31.  
  32. -!--8<---------------------------------
  33.  
  34. void draw_box(byte x,byte y,byte x2,byte y2)
  35. {
  36.   unsigned int b1,b2;
  37.   char box[]={'\xD5','\xB8','\xD4','\xBE','\xCD','\xB3'};
  38.  
  39.   window(x,y,x2,y2);
  40.   clrscr();
  41.   window(1,1,80,25);
  42.  
  43.   gotoxy(x,y);
  44.   putch(box[0]);
  45.   for(b1=(x2-x)-1;b1>0;b1--)
  46.   {
  47.     putch(box[4]);
  48.   }
  49.   putch(box[1]);
  50.  
  51.   for(b1=y+1;b1<y2;b1++)
  52.   {
  53.         gotoxy(x,b1);
  54.     putch(box[5]);
  55.     gotoxy(x2,b1);
  56.     putch(box[5]);
  57.   }
  58.  
  59.   gotoxy(x,y2);
  60.   putch(box[2]);
  61.   for(b1=(x2-x)-1;b1>0;b1--)
  62.   {
  63.         putch(box[4]);
  64.   }
  65.   putch(box[3]);
  66.   gotoxy(x+1,y+1);
  67.  
  68. }
  69.  
  70. -!------------------------->8----------
  71.  
  72. This works pretty good. I use it when ever I don't want to include a windowing l
  73. ibarry in a programme. Enjoy.. :)
  74.  
  75. Chow...
  76.        Brian
  77.  
  78. --- timEd/B8
  79.  * Origin: ** Dragon's Eye BBS  604/-Unpublished-  2400 BPS! ** (1:153/612)
  80. SEEN-BY: 1/211 11/2 4 13/13 101/1 108/89 109/25 110/69 114/5 123/19 124/1
  81. SEEN-BY: 153/752 154/40 77 157/2 159/100 125 575 950 203/23 209/209 261/1023
  82. SEEN-BY: 280/1 390/1 396/1 5 15 2270/1 2440/5 3603/20
  83.